<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<div class="rounded">
					<div class="top_rounded">
						<div class="t_l_r"></div>
						<div class="t_r_r"></div>
						<div class="t_mid_r"></div>
					</div>
  <div class="mid_rounded gallery right_h">
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div id="slideshow" class="category-products">
    <?php //echo $this->getToolbarHtml() ?>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php // List mode ?>
    <?php if(true): ?>
    <?php $_iterator = 0; ?>
    <div id="slidesContainer">
	<div class="slide">
  <ul id="mycarousel" class="pro_img_list">
  
    <?php foreach ($_productCollection as $_product): ?>
                                        <li >
											<div><a rel="prettyPhoto[gallery1]" href="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" /></a></div>
											<div class="pro_sub_info">
												<p class="pro_list_name"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></p>
                                                <p class="proclick"><a href="<?php echo $_product->getProductUrl() ?>">View</a> / <a href="<?php echo $this->getAddToCompareUrl($_product) ?>">Compare</a></p>
											</div>
										</li>

     
    <?php endforeach; ?>
		</ul>
									<script type="text/javascript" charset="utf-8">
							jQuery(document).ready(function($){
								$("area[rel^='prettyPhoto']").prettyPhoto();
								
								$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:3000, autoplay_slideshow: true});
								$(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});
						
								$("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
									custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
									changepicturecallback: function(){ initialize(); }
								});
						
								$("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
									custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
									changepicturecallback: function(){ _bsap.exec(); }
								});
							});
							</script>
								</div>
							</div>
   

    <?php else: ?>

    <?php // Grid Mode ?>

    <?php $_collectionSize = $_productCollection->count() ?>
    <?php //$_columnCount = $this->getColumnCount(); ?>
    <?php $_columnCount = 5; ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>
        <ul class="products-grid">
        <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
            	<div class="prodwrapper">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" width="154" height="220" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
                <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
                <div class="actions">
                    <?php if($_product->isSaleable()): ?>
                       
                    <?php else: ?>
                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                    <?php endif; ?>
                    <ul class="add-to-links">
                        <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                            <li><a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Compare') ?></a></li>
                        <?php endif; ?>
                    </ul>
                </div>
                <div class="image-top"></div>
                <div class="image-bottom"></div>
		</div>
            </li>
        <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
        </ul>
        <?php endif ?>
        <?php endforeach ?>
        <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
    <?php endif; ?>

    <div class="toolbar-bottom">
        <?php echo $this->getToolbarHtml() ?>
    </div>
</div>
<?php endif; ?>
	</div>
					<div class="bottom_rounded">
						<div class="b_l_r"></div>
						<div class="b_r_r"></div>
						<div class="b_mid_r"></div>
					</div>
                </div>

<script type="text/javascript">
jQuery(document).ready(function($){
  var currentPosition = 0;
  var slideWidth = 170;
  var slides = $('.slide');
  var numberOfSlides = slides.length;
  var tdnum = $("#mycarousel li").length;

  // Wrap all .slides with #slideInner div
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
      'width' : slideWidth*tdnum,
	  'overflow' : 'hidden'
    });
	
	$("#mycarousel").css("width",tdnum*170/2);

  // Set #slideInner width equal to total width of all slides
  //$('#slideInner').css('width', slideWidth * numberOfSlides);
  $('#slideInner').css('width', slideWidth * tdnum)
  // Insert controls in the DOM
  $('#slideshow')
    .prepend('<span class="control" id="leftControl"></span>')
   .append('<span class="control" id="rightControl"></span>');

  // Hide left arrow control on first load
  manageControls(currentPosition);

  // Create event listeners for .controls clicks
  $('.control')
    .bind('click', function(){
    // Determine new position
	currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
    
	// Hide / show controls
    manageControls(currentPosition);
    // Move slideInner using margin-left
    $('#slideInner').animate({
      'marginLeft' : slideWidth*(-currentPosition)
    });
  });

  // manageControls: Hides and Shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
	if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
	// Hide right arrow if position is last slide
    if(position==tdnum/2-4){ $('#rightControl').hide() } else{ $('#rightControl').show() ;}
  }	
});

// The image list must be double the number of images
</script>


